<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
use think\facade\Route;

//跨域请求
header("Access-Control-Allow-Origin:http://localhost:9529");
header('Access-Control-Allow-Headers:token,content-type');
header('Access-Control-Allow-Credentials:true');

// Route::group('v1', function () {

// })->prefix("admin/")->allowCrossDomain([
//     'Access-Control-Allow-Origin'        => '*',
//     'Access-Control-Allow-Credentials'   => 'true',
//     'Access-Control-Allow-Headers'   => 'token,Content-Type',
// ]);
//Route::get('users', 'wap/v1.user/getUsers');
//无需登录就可访问的公共接口
// Route::group(function () {
    
//     //用户退出登录
//     Route::rule('logout$', 'userLogout');
//     //用户用手机号注册账户
//     Route::rule('reg/phone$', 'phoneReg');
// })->prefix('index/');
//用户登录
Route::rule('user/login$', 'admin/index/login');
Route::rule('user/logout$', 'admin/index/logout');

Route::group('user', function () {
    Route::get('list$', 'admin/user/list');
    Route::get('info$', 'admin/index/user_info');
    Route::post('add$', 'admin/user/add');
    Route::post('update$', 'admin/user/update');
    Route::post('delete$', 'admin/user/delete');
});

//菜单
Route::group('menu', function () {
    Route::get('list$', 'admin/menu/list');
    Route::get('find$', 'admin/menu/find');
    Route::get('tree$', 'admin/menu/tree');
    Route::post('add$', 'admin/menu/add');
    Route::post('update$', 'admin/menu/update');
    Route::post('delete$', 'admin/menu/delete');
});
//角色
Route::group('roles', function () {
    Route::get('all$', 'admin/roles/all');
    Route::get('list$', 'admin/roles/list');
    Route::get('find$', 'admin/roles/find');
    Route::post('add$', 'admin/roles/add');
    Route::post('update$', 'admin/roles/update');
    Route::post('delete$', 'admin/roles/delete');
    Route::post('menu$', 'admin/roles/update_menu');
    Route::get('level$', 'admin/roles/get_level');
});

Route::group('file', function () {
    Route::post('upload_img$', 'admin/file/upload_img');
});
Route::group('real', function () {
    Route::post('add$', 'admin/real/add');
    Route::post('update$', 'admin/real/update');
    Route::post('delete$', 'admin/real/delete');
    Route::post('audit$', 'admin/real/audit');
    Route::get('list$', 'admin/real/list');
    Route::get('find$', 'admin/real/find');
});
